import { defHttp } from '/@/utils/http/axios';
import { ContentTypeEnum } from '/@/enums/httpEnum';

enum Diary {
  getWorkLogList = '/admin-api/system/work-log/page',
  getWorkLogAdd = '/admin-api/system/work-log/create',
  getWorkLogEdit = '/admin-api/system/work-log/update',
  getDeptSimple = '/admin-api/system/dept/list',
  getUserSimple = '/admin-api/system/user/list-all-simple',
  getWorkDelete = '/admin-api/system/work-log/delete',
}

/**
 * @description: 获字典
 */
export const workLogList = (params: any) => {
  return defHttp.get<any>({ url: Diary.getWorkLogList, params });
};
export const workLogAdd = (params: any) => {
  return defHttp.post<any>({ url: Diary.getWorkLogAdd, params });
};
export const workLogEdit = (params: any) => {
  return defHttp.put<any>({ url: Diary.getWorkLogEdit, params });
};
export const deptSimple = (params: any) => {
  return defHttp.get<any>({ url: Diary.getDeptSimple, params });
};
export const userSimple = (params: any) => {
  return defHttp.get<any>({ url: Diary.getUserSimple, params });
};
export const workLogDelete = (params: any) => {
  return defHttp.delete<any>(
    {
      url: Diary.getWorkDelete,
      params,
      headers: { 'Content-Type': ContentTypeEnum.FORM_URLENCODED },
    },
    { joinParamsToUrl: true },
  );
};
